#include <iostream>
using std::cout;
using std::endl;

class Point{
public:
    /* explicit//禁止隐式转换 */
    Point(int x = 0,int y = 0)
    : _ix(x)
    , _iy(y)
    {
        cout << "Point(int,int)" << endl;
    }

    Point(const Point & rhs)
    : _ix(rhs._ix)
    , _iy(rhs._iy)
    {
        cout << "Point(const Point &)" << endl;
    }

    ~Point(){
        cout << "~Point()" << endl;
    }

    void print() const{
        cout << "(" << _ix
            << "," << _iy
            << ")" << endl;
    }
private:
    int _ix;
    int _iy;
};

void test0(){
    Point pt(1,2);
    //缺省调用
    Point pt2(3);
    Point pt3;

    //隐式转换
    //编译器会尝试使用一个int型参数初始化一个匿名的Point对象
    //再通过拷贝构造初始化pt4
    //Point pt4 = Point(3);
    Point pt4 = 3;
    pt4.print();
}

int main(void){
    test0();
    return 0;
}
